/*
 * Project Name demo
 * File Name ChatSession
 * Package Name com.huxiaosu.demo.socketio.entity
 * Create Time 2023/1/31
 * Create by name：liujie
 */
package com.huxiaosu.demo.socketio.entity;

import com.huxiaosu.demo.socketio.util.IDUtil;
import lombok.Data;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * Description
 *
 * @ClassName: ChatSession
 * @author: liujie
 * @date: 2023/1/31 14:35
 */
@Data
@MappedSuperclass
public class BaseEntity implements Serializable {
    /**
     * id
     */
    @Id
    @Column(name = "id",length = 32)
    private String id = IDUtil.randomID();
    @Column(name = "create_time")
    private Date createTime = new Date();
    @LastModifiedDate
    @Column(name = "update_time")
    private Date updateTime;
    @Column(name = "status")
    private Integer status = 0;
    /**
     * 0 未删除  1 已删除  默认 0
     * 使用时 请在对应的对象上面增加
     * <pre>@SQLDelete(sql = "update {table_name} set deleted = 1 where id = ?")</pre>
     *  <pre>@Where(clause = "deleted = 0")</pre>
     * @return
     * @author liujie
     * @date 2022/9/23 10:06
     */
    @Column(name = "deleted")
    private Integer deleted = 0;
}